/**
 * 
 */
package cz.cvut.fit.crhonjar.mi.paa.thames;

import java.util.HashSet;

/**
 * @author Jarec
 * 
 */
public class State implements Cloneable {

	private final HashSet<Item> items;
	private int price;
	private int weigth;

	/**
	 * @param items
	 * @param price
	 * @param weigth
	 */
	public State(final HashSet<Item> items, final int price, final int weigth) {
		this.items = items;
		this.price = price;
		this.weigth = weigth;
	}

	/**
	 * @param i
	 */
	public void addItem(final Item i) {
		this.items.add(i);
		this.price += i.getPrice();
		this.weigth += i.getWeight();
	}

	@Override
	public State clone() throws CloneNotSupportedException {
		return new State(new HashSet<Item>(this.items), this.price, this.weigth);
	}

	/**
	 * @return
	 */
	public HashSet<Item> getItems() {
		return this.items;
	}

	/**
	 * @return
	 */
	public int getPrice() {
		return this.price;
	}

	/**
	 * @return
	 */
	public int getWeigth() {
		return this.weigth;
	}

}